#include <algorithm>
#include <cstring>
#include <iostream>
using namespace std;
using ll = long long;
using T = int;
T rad(); // quick read
const int inf = 0x3f3f3f3f;
#define rf(i, n) for (int i = 1; i <= (n); ++i)
const int max_size = 5 + 100;
const int maxn = 5 + 100;

// 曲面方程
inline ll fx1(ll x, ll y, ll z) { return 1000 * x - y * y - z * z; }
inline ll fx2(ll x, ll y, ll z) { return -1000 * x - y * y - z * z; }

inline bool aside(int x1, int y1, int z1, int x2, int y2, int z2) {
    return (fx1(x1, y1, z1) > 0) ^ (fx1(x2, y2, z2) > 0) || (fx2(x1, y1, z1) > 0) ^ (fx2(x2, y2, z2) > 0);
}
inline bool check(int x1, int y1, int z1, int x2, int y2, int z2) {
    return aside(x1, y1, z1, x2, y2, z2) || aside(y1, z1, x1, y2, z2, x2) || aside(z1, x1, y1, z2, x2, y2);
}

inline bool solve(int x1, int y1, int z1, int x2, int y2, int z2) {
    return check(x1, y1, z1, x2, y2, z2) || check(y1, x1, z1, y2, x2, z2);
}

int main() {
    int Q = rad();
    while (Q--) {
        int x1 = rad(), y1 = rad(), z1 = rad(), x2 = rad(), y2 = rad(), z2 = rad();
        if (solve(x1, y1, z1, x2, y2, z2))
            puts("No");
        else
            puts("Yes");
    }
}

T rad() {
    T back = 0;
    int ch = 0, posi = 0;
    for (; ch < '0' || ch > '9'; ch = getchar())
        posi = ch ^ '-';
    for (; ch >= '0' && ch <= '9'; ch = getchar())
        back = (back << 1) + (back << 3) + (ch & 0xf);
    return posi ? back : -back;
}